#Makefile for libalgebra
#Copyright (C) 2007 Notyet
#
#这是algebra库的一部分。
#
#algebra是一个基于C开发的库，旨在解决代数式化简与解简单方程的问题。
#
#联系方式：
#E-Mail:nt1900@gmail.com
CC=gcc
AR=ar
CFLAGES=-I include #-Wall
ARFLAGES=cqs
INCLUDES=include/libalgebra.h include/converter.h include/formula.h include/base.h include/letter.h
OBJS=src/converter.o src/formula.o src/base.o src/letter.o src/alglib.o
OUT=libalgebra.a
DEMO=demo

#All Phony Targets
.PHONY: everything clean all

#Default starting position
#----------------
everything: $(OUT) $(DEMO)
clean:
	rm -f src/*.o
	rm -f libalgebra.a
	rm -f demo
all: clean everything
#----------------

#---FILES
src/alglib.o: include/alglib.h $(@:.o=.c)
	$(CC) $(CFLAGES) -o $@ -c $(@:.o=.c)
src/letter.o: $(INCLUDE) $(@:.o=.c)
	$(CC) $(CFLAGES) -o $@ -c $(@:.o=.c)
src/converter.o: $(INCLUDES) $(@:.o=.c)
	$(CC) $(CFLAGES) -o $@ -c $(@:.o=.c)
src/formula.o: $(INCLUDES) $(@:.o=.c)
	$(CC) $(CFLAGES) -o $@ -c $(@:.o=.c)
src/base.o: $(INCLUDES) $(@:.o=.c)
	$(CC) $(CFLAGES) -o $@ -c $(@:.o=.c)
libalgebra.a:$(OBJS)
	$(AR) $(ARFLAGES) $@ $(OBJS)
demo: $(INCLUDES) $(OUT) demo_src/main.c
	$(CC) demo_src/main.c -I include -lalgebra -L . -Wall -o $@
